<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="https://www.thymeleaf.org"
      xmlns:sec="https://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
    <meta charset="UTF-8">
    <title>test</title>
</head>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
    function changeCode() {
        const src = "/getVerifyCode?" + new Date().getTime(); //加时间戳，防止浏览器利用缓存
        $('.verifyCode').attr("src", src);
    }
</script>
<body>
<a href="javascript:void(0);" rel="external nofollow" title="点击更换验证码">
    <img th:src="@{getVerifyCode}" onclick="changeCode()" class="verifyCode"/>
</a>
</body>
</html>